package net.sharpf2.api;

import net.sharpf2.sfcore.client.Client;
import net.sharpf2.sfcore.client.Player;
import net.sharpf2.api.types.Content;
import net.sharpf2.sfcore.bot.Controller;


/**
 * Global class for methods
 * @author Rick van Biljouw
 */
public class Methods extends BaseMethods {
    
    @Override
    public void setController(Controller controller) {
        super.setController(controller);
        Globals.METHODS = this;
        Globals.CONTROLLER = controller;
        Globals.CLIENT = super.client;
    }
    
    /**
     * Gets the Client.
     * @return Client.
     */
    public static Client getClient() {
        return Globals.CLIENT;
    }
    
    /**
     * Gets current player.
     * @return Content<Player>
     */
    public static Content<Player> getMyPlayer() {
        return new Content<Player>(Globals.CLIENT.getLocalPlayer());
    }
    
    /**
     * Sleeps.
     * @param ms Time to sleep.
     */
    public static void sleep(int ms) {
        try {
            Thread.sleep(ms);
        } catch (InterruptedException ex) {
            Thread.currentThread().interrupt();
        }
    }
    
}
